﻿<%@ Page Language="C#" Title="路面性能模型分组" MasterPageFile="~/W_View/PageMaster.Master" CodeBehind="Dm_Oripv_AnagroupPage.aspx.cs" Inherits="STHPMS1.Web.W_View.Decision.Dm_Oripv_AnagroupPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/datagrid.js")%>

    <script type="text/javascript">      

		function Dm_Oripv_AnagroupEdit(flag)
        {
		    var row = $('#dg').datagrid('getSelected');
		    var title = "";
		    if (flag == 0) {
		        if (!row) {
		            $.messager.alert('消息提示', '编辑数据时，请选择一项!', 'warning');
		            return;
		        }

		        $('#Ansgroup_Id').textbox('readonly', true);
		        $('#fm').form('load', row);
		    }
		    else {
		        $('#fm').form('clear');
		        $('#Ansgroup_Id').textbox('readonly', false);
		    }

		    $('#dlg').dialog('open');
        }

        function Dm_Oripv_AnagroupDel() {
            var row = $('#dg').datagrid('getSelected');
            if (!row) {
                $.messager.alert('消息提示', '删除数据时，请选择一项!', 'warning');
                return;
            }

            $.ajax({
                type: "Delete",
                url: "/api/oripv_anagroup",
                data: row,
                success: function () {
                    $('#dg').datagrid("reload");
                    $('#dlg').dialog('close');
                },
                error: function (err) {
                    $.messager.alert('错误提示', err.responseJSON.ExceptionMessage, "error");
                }
            });
        }

        function sumbitD() {

            $.messager.progress({
                title: '请等待',
                msg: '加载数据中...'
            });

            $("#fm").ajaxSubmit({
                complete: function () {
                    $.messager.progress('close');
                },
                success: function (responseText) {
                    $('#dg').data().datagrid.selectRowIndex = null;
                    $('#dg').datagrid('reload');
                    $('#dlg').dialog('close');
                },
                error: function (err) {
                    $.messager.alert('错误提示', err.responseJSON.ExceptionMessage, "error");
                }
            });
        }

        var dg1;
        function Dm_Oripv_FormulaEdit(flag) {
            var title = "";
            if (flag < 0) {
                $('#fm1').form('clear');
                $('#Ansgroup_Id1').textbox('readonly', false);
                if (flag ==-1) {
                    $('#Modelmode').combobox('setValue', 821);
                    $('#Formulatype').combobox('setValue', 501);
                    dg1 = $('#dg1');
                }
                else {
                    $('#Modelmode').combobox('setValue', 823);
                    $('#Formulatype').combobox('setValue', 502);
                    dg1 = $('#dg2');
                }
            }
            else {
                var row = null;
                if (flag == 0)
                {
                    row = $('#dg1').datagrid('getSelected');
                    $('#Modelmode').combobox('setValue', 821);
                    $('#Formulatype').combobox('setValue', 501);
                    dg1 = $('#dg1');
                }                   
                else
                {
                    row = $('#dg2').datagrid('getSelected');
                    $('#Modelmode').combobox('setValue', 823);
                    $('#Formulatype').combobox('setValue', 502);
                    dg1 = $('#dg2');
                }

                if (!row) {
                    $.messager.alert('消息提示', '编辑数据时，请选择一项!', 'warning');
                    return;
                }

                var rect = {};
                rect.value = row.Formulatype;
                formulaSelect(rect);

                $('#Ansgroup_Id1').textbox('readonly', true);
                $('#fm1').form('load', row);
            }

            $('#dlg1').dialog('open');
        }

        function Dm_Oripv_FormulaDel(flag) {
            var row = null;
            if (flag == 0)
                row = $('#dg1').datagrid('getSelected');
            else
                row = $('#dg2').datagrid('getSelected');

            if (!row) {
                $.messager.alert('消息提示', '删除数据时，请选择一项!', 'warning');
                return;
            }

            $.ajax({
                type: "Delete",
                url: "/api/oripv_anagroup/after_d",
                data: row,
                success: function () {
                    if (flag == 0)
                        $('#dg1').datagrid("reload");
                    else
                        $('#dg2').datagrid("reload");

                    $('#dlg1').dialog('close');
                },
                error: function (err) {
                    $.messager.alert('错误提示', err.responseJSON.ExceptionMessage, "error");
                }
            });
        }

        function sumbitD1() {

            $.messager.progress({
                title: '请等待',
                msg: '加载数据中...'
            });

            $("#fm1").ajaxSubmit({
                complete: function () {
                    $.messager.progress('close');
                },
                success: function (responseText) {
                    dg1.data().datagrid.selectRowIndex = null;
                    dg1.datagrid('reload');
                    $('#dlg1').dialog('close');
                },
                error: function (err) {
                    $.messager.alert('错误提示', err.responseJSON.ExceptionMessage, "error");
                }
            });
        }


        function formulaSelect(rect)
        {
            $('#Formulacoeff3').show();
            $('#Formulacoeff4').show();
            $('#Formulacoeff5').show();
            if (rect && rect.value == 501) {
                $('#Formulacoeff3').hide();
                $('#Formulacoeff4').hide();
                $('#Formulacoeff5').hide();
            } else if (rect && rect.value == 502) {
                $('#Formulacoeff4').hide();
                $('#Formulacoeff5').hide();
            }
        }

        $(function () {
            var number= '<%= Page.RouteData.Values["page"] %>';
            var size = '<%= Page.RouteData.Values["size"] %>';

            dataGridBind($('#dg'), '/api/oripv_anagroup', '', $('#tb'), number, size);
            $('#dg').datagrid({ pagination: false });
            dataGridBind($('#dg1'), '/api/oripv_anagroup/line', '', $('#tb1'), number, size);
            $('#dg1').datagrid({ pagination: false });
            dataGridBind($('#dg2'), '/api/oripv_anagroup/tab', '', $('#tb2'), number, size);
            $('#dg2').datagrid({ pagination: false });


            $('.validatebox-text').bind('blur', function () {
                $(this).validatebox('enableValidation').validatebox('validate');
            });
        })

        
    </script>    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">  
   
     <div id="tb">
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="Dm_Oripv_AnagroupEdit(-1)">添加</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true" onclick="Dm_Oripv_AnagroupEdit(0)">编辑</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="Dm_Oripv_AnagroupDel()">删除</a>        
    </div>

    <div id="tb1">
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="Dm_Oripv_FormulaEdit(-1)">添加</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true" onclick="Dm_Oripv_FormulaEdit(0)">编辑</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="Dm_Oripv_FormulaDel(0)">删除</a>        
    </div>

     <div id="tb2">
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="Dm_Oripv_FormulaEdit(-2)">添加</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true" onclick="Dm_Oripv_FormulaEdit(1)">编辑</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="Dm_Oripv_FormulaDel(1)">删除</a>        
    </div>
    
    <div id="dlg" class="easyui-dialog" title="保存数据" style="width:400px;height:340px;padding:10px" closed="true"  data-options="
				iconCls: 'icon-save',
				buttons: '#dlg-buttons'
			">
        <form id="fm" method="post" action="/api/oripv_anagroup">
            <table>			     
                <tr>
                    <td>分析组ID:</td>
                    <td><input id="Ansgroup_Id"  name='Ansgroup_Id' class='easyui-validatebox easyui-textbox'  /></td>
                </tr>
                <tr style="display:none">
                    <td>分析组名称:</td>
                    <td><input name='Ansgroup_Name' class='easyui-validatebox easyui-textbox'  /></td>
                </tr>
                <tr>
                    <td>路面类型:</td>
                    <td><input name='Pvmttype_Dictid'  class="easyui-combobox" data-options="required:true,prompt:'路面类型',valueField:'id',textField:'text',url:'/api/data/pavement',method:'get' "/></td>
                </tr>
                <tr>
                    <td>面层厚度最小值:</td>
                    <td><input name='Surf_Thickmin' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr>
                    <td>面层厚度最大值/cm:</td>
                    <td><input name='Surf_Thickmax' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr>
                    <td>土基模量最小值/MPa:</td>
                    <td><input name='Submodumin' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr>
                    <td>土基模量最大值/MPa:</td>
                    <td><input name='Submodumax' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr>
                    <td>公式系统类型:</td>
                    <td><select class="easyui-combobox" name="Formulatype" style="width:170px;" >
		                    <option value="500">原路面直线公式</option>
	                    </select>
                     </td>
                </tr>
                <tr>
                    <td>公式系数 1:</td>
                    <td><input name='Formulacoeff1' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>

		    </table>
        </form>
    </div>

    <!--编辑数据命令-->
    <div id="dlg-buttons">
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:sumbitD()">保存</a>
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:$('#dlg').dialog('close')">取消</a>
	</div>


     <div id="dlg1" class="easyui-dialog" title="保存数据" style="width:400px;height:340px;padding:10px" closed="true"  data-options="
				iconCls: 'icon-save',
				buttons: '#dlg1-buttons'
			">
        <form id="fm1" method="post" action="/api/oripv_anagroup/after_s">
            <table>			     
                <tr>
                    <td>衰变公式名称:</td>
                    <td><input id="Ansgroup_Id1" name='Ansgroup_Id' class='easyui-validatebox easyui-textbox'  /></td>
                </tr>
                <tr>
                    <td>养护措施:</td>                    
	                <td><input name='Measure'  class="easyui-combobox" data-options="prompt:'养护措施',valueField:'id',textField:'text',url:'/api/data/maintype',method:'get'"/></td>
                </tr>
                <tr>
                    <td>性能指标:</td>
                     <td><select class="easyui-combobox" name="Regre_Index" style="width:170px;">
		                    <option value="802">PCI</option>
                            <option value="803">PSSI</option>
	                    </select></td>
                </tr>

                <tr>
                    <td>公式系统类型:</td>                    
                    <td><select class="easyui-combobox" name="Formulatype" id="Formulatype" style="width:170px;" data-options="readonly:true,onSelect:formulaSelect">
		                    <option value="501">养护后直线公式</option>
		                    <option value="502">养护后多项式公式</option>
	                    </select>
                     </td>
               </tr>
                <tr>
                    <td>模型形式:</td>
                    <td><select class="easyui-combobox" name="Modelmode" id="Modelmode" style="width:170px;" data-options='readonly:true'>
		                    <option value="821">直线型</option>
		                    <option value="823">多项式型</option>
	                    </select>
                     </td>
                </tr>
                <tr>
                    <td>公式系数1:</td>
                    <td><input name='Formulacoeff1' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr >
                    <td>公式系数2:</td>
                    <td><input name='Formulacoeff2' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr id="Formulacoeff3">
                    <td>公式系数3:</td>
                    <td><input name='Formulacoeff3' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
                <tr id="Formulacoeff4">
                    <td>公式系数4:</td>
                    <td><input name='Formulacoeff4' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr >
                <tr id="Formulacoeff5">
                    <td>公式系数5:</td>
                    <td><input name='Formulacoeff5' class='easyui-validatebox easyui-numberbox'  data-options='min:0,precision:2' /></td>
                </tr>
		    </table>
        </form>
    </div>

    <!--编辑数据命令-->
    <div id="dlg1-buttons">
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:sumbitD1()">保存</a>
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:$('#dlg1').dialog('close')">取消</a>
	</div>

    <div id="aa" class="easyui-accordion" style="width:auto;height:auto;">
        <div title="原路面性能模型分组" style="overflow:auto;padding:10px;">
			 <table id="dg" class="easyui-datagrid content-place"  ajaxCached="false"  data-options="onLoadSuccess:function(data){ MergeCells('dg','type,comment');}">
                <thead>
                    <tr>
                         <th data-options="field:'type',editor:'text',width:160,align:'center' ">路面类型</th>
                        <th data-options="field:'thick',editor:'text',width:160,align:'center' ">面层厚度/cm</th>
                        <th data-options="field:'submodu',editor:'text',width:160,align:'center',hidden:true ">土基模量/MPa</th>
                        <th data-options="field:'formula',editor:'text',width:160,align:'center' ">衰变方程</th>
                        <th data-options="field:'Ansgroup_Id',editor:'text',width:200,align:'center' ">模型组</th>      
                        <th data-options="field:'Pvmttype_Dictid',editor:'numberbox',width:80,align:'right' ,hidden:true">路面类型</th>
                        <th data-options="field:'Surf_Thickmin',editor:'numberbox',width:80,align:'right' ,hidden:true">面层厚度最小值cm </th>
                        <th data-options="field:'Surf_Thickmax',editor:'numberbox',width:80,align:'right' ,hidden:true">面层厚度最大值/cm</th>
                        <th data-options="field:'Submodumin',editor:'numberbox',width:80,align:'right' ,hidden:true">土基模量最小值</th>
                        <th data-options="field:'Submodumax',editor:'numberbox',width:80,align:'right' ,hidden:true">土基模量最大值</th>
                        <th data-options="field:'Formulatype',editor:'numberbox',width:80,align:'right' ,hidden:true">公式系统类型</th>
                        <th data-options="field:'Formulacoeff1',editor:'numberbox',width:80,align:'right' ,hidden:true">公式系数 1</th>
                        <th data-options="field:'comment',editor:'text',width:120,align:'center' ">备注</th>    
                    </tr>                   
                </thead>
            </table>
		</div>
        <div title="实施养护后模型分组（直线型）"  style="overflow:auto;padding:10px;">
			 <table id="dg1" class="easyui-datagrid content-place"  ajaxCached="false"  data-options="onLoadSuccess:function(data){ MergeCells('dg1','type,comment');}">
                <thead>
                    <tr>
                        <th data-options="field:'type',editor:'text',width:160,align:'center' ">养护措施</th>
                        <th data-options="field:'coeff',editor:'text',width:160,align:'center' ">性能指标</th>
                        <th data-options="field:'formula',editor:'text',width:260,align:'center' ">实施养护后衰变曲线</th>
                        <th data-options="field:'Ansgroup_Id',editor:'text',width:200,align:'center' ">模型组</th>      
                        <th data-options="field:'Measure',editor:'numberbox',width:80,align:'right' ,hidden:true">养护措施</th>
                        <th data-options="field:'Regre_Index',editor:'numberbox',width:80,align:'right' ,hidden:true">性能指标</th>
                        <th data-options="field:'Formulatype',editor:'numberbox',width:80,align:'right' ,hidden:true">公式系统类型</th>
                        <th data-options="field:'Formulacoeff1',editor:'numberbox',width:80,align:'right' ,hidden:true">公式系数1</th>
                        <th data-options="field:'Formulacoeff2',editor:'numberbox',width:80,align:'right' ,hidden:true">公式系数2</th>
                        <th data-options="field:'Formulacoeff3',editor:'numberbox',width:80,align:'right' ,hidden:true">公式系数3</th>
                        <th data-options="field:'Formulacoeff4',editor:'numberbox',width:80,align:'right' ,hidden:true">公式系数4</th>
                        <th data-options="field:'Formulacoeff5',editor:'numberbox',width:80,align:'right' ,hidden:true">公式系数5</th>
                        <th data-options="field:'Modelmode',editor:'numberbox',width:80,align:'right',hidden:true ">模型形式</th>
                        <th data-options="field:'comment',editor:'text',width:120,align:'center' ">备注</th>    
                    </tr>
                </thead>
            </table>
		</div>
         <div title="实施养护后模型分组（多项型）"  style="overflow:auto;padding:10px;">
			 <table id="dg2" class="easyui-datagrid content-place"  ajaxCached="false"  data-options="onLoadSuccess:function(data){ MergeCells('dg2','type,comment');}">
                <thead>
                    <tr>
                        <th data-options="field:'type',editor:'text',width:160,align:'center' ">养护措施</th>
                        <th data-options="field:'coeff',editor:'text',width:160,align:'center' ">性能指标</th>
                        <th data-options="field:'formula',editor:'text',width:260,align:'center' ">实施养护后衰变曲线</th>
                        <th data-options="field:'Ansgroup_Id',editor:'text',width:200,align:'center' ">模型组</th>      
                        <th data-options="field:'Measure',editor:'numberbox',width:80,align:'right' ,hidden:true">养护措施</th>
                        <th data-options="field:'Regre_Index',editor:'numberbox',width:80,align:'right' ,hidden:true">性能指标</th>
                        <th data-options="field:'Formulatype',editor:'numberbox',width:80,align:'right' ,hidden:true">公式系统类型</th>
                        <th data-options="field:'Formulacoeff1',editor:'numberbox',width:80,align:'right' ,hidden:true">公式系数1</th>
                        <th data-options="field:'Formulacoeff2',editor:'numberbox',width:80,align:'right' ,hidden:true">公式系数2</th>
                        <th data-options="field:'Formulacoeff3',editor:'numberbox',width:80,align:'right' ,hidden:true">公式系数3</th>
                        <th data-options="field:'Formulacoeff4',editor:'numberbox',width:80,align:'right' ,hidden:true">公式系数4</th>
                        <th data-options="field:'Formulacoeff5',editor:'numberbox',width:80,align:'right' ,hidden:true">公式系数5</th>
                        <th data-options="field:'Modelmode',editor:'numberbox',width:80,align:'right',hidden:true ">模型形式</th>
                        <th data-options="field:'comment',editor:'text',width:120,align:'center' ">备注</th>    
                    </tr>                  
                </thead>
            </table>
		</div>
	</div>
</asp:Content>
